<?php

namespace app\controllers\h5\uni;

use app\controllers\h5\base\H5Controller;
use app\models\order\Order;

class TipController extends H5Controller
{
    // home tips
    public function actionIndex()
    {
        $order = Order::find()
            ->with('user')
            ->orderBy(['id' => SORT_DESC])
            ->limit(30)
            ->asArray()
            ->all();

        foreach ($order as &$item) {
            if ($item['user']['nickname']) {
                $item['user']['nickname'] = base64_decode($item['user']['nickname']);
            }
        }

        return $this->successEncode(['list' => $order]);
    }
}